Package words.images

Source Code of words.images.ApacheExtractImages

package words.images;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.List;

import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.Picture;

public class ApacheExtractImages
{
  public static void main(String[] args) throws Exception
  {
    HWPFDocument doc = new HWPFDocument(new FileInputStream(
        "data/document.doc"));
    List<Picture> pics = doc.getPicturesTable().getAllPictures();
   
    for (int i = 0; i < pics.size(); i++)
    {
      Picture pic = (Picture) pics.get(i);
   
      FileOutputStream outputStream = new FileOutputStream(
          "data/apacheImages/" + "Apache_"
              + pic.suggestFullFileName());
      outputStream.write(pic.getContent());
      outputStream.close();
    }
  }
}
TOP

Related Classes of words.images.ApacheExtractImages

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.